/**
 * Moondance UML modeling tool
 * 
 * @author Dascalu Laurentiu (dascalu.laurentziu@gmail.com).
 * 
 * This program is free software; you can redistribute it and
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 3
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

package ro.pub.cs.se.moondance.xmi.converter;

import org.w3c.dom.Document;
import org.w3c.dom.Element;

public class UMLRealizationConnectionXMI extends UMLConnectionXMI {

	public UMLRealizationConnectionXMI(String name, String id, String source, String destination) {
		super(name, XMICommon.UML_REALIZATION, id, source, destination,
				null, null, null, null, null, null, null, null, null, null);
	}

	/**
	 * Example for REALIZATION
	 * <packagedElement
	 *     xmi:type="uml:Realization"
	 *     xmi:id="_pw9vYWceEd6eLuBoYJyKmQ"
	 *     name="LabelOnRealizationConnection"
	 *     supplier="_A9hI0GcPEd67F_7YoWwK5g" // destination
	 *     client="_RRTvIGcJEd67F_7YoWwK5g"/> // source
	 */

	@Override
	public void serialize(Element root, Document document) {
		Element realizationElement = document.createElement(XMICommon.PACKED_ELEMENT);
		
		realizationElement.setAttribute(XMICommon.XMI_TYPE, type);
		realizationElement.setAttribute(XMICommon.XMI_ID, xmiID);
		realizationElement.setAttribute(XMICommon.NAME, name);
		realizationElement.setAttribute(XMICommon.SUPLIER, source);
		realizationElement.setAttribute(XMICommon.CLIENT, destination);
		
		root.appendChild(realizationElement);
	}
}
